﻿@using MvcCheckBoxList.Model
@using MVCControlsToolkit.Controls
@using MVCControlsToolkit.Controls.Bindings
@using MVCControlsToolkit.Core
@using TamoCRM.Domain.UserRole
@{
    ViewBag.Title = "Permission";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}
@model TamoCRM.Web.Mvc.Areas.Admin.Models.Roles.PermissionModel
<div class="breadcrumbs" id="breadcrumbs">
    <script type="text/javascript">
        try { ace.settings.check('breadcrumbs', 'fixed') } catch (e) { }
    </script>

    <ul class="breadcrumb">
        <li>
            <i class="icon-home home-icon"></i>
            <a href="/Home">Trang chủ</a>
        </li>

        <li>
            <a href="javascript:void(0);">Danh mục</a>
        </li>
        <li class="active">Phân quyền</li>
    </ul>
</div>

<div class="page-content">
    <div class="page-header">
        <h1>Phân quyền chức năng</h1>
    </div>
    <!-- /.page-header -->

    <div class="row">
        @using(Html.BeginForm("Permission","Role",FormMethod.Post,new {@id="frmpermission"})){
        @Html.AntiForgeryToken()
        <div class="col-xs-12">
            Nhóm người dùng @Html.DropDownListFor(x=>x.SelectedRoleID,Model.Roles)
        </div>
        <div class="col-xs-12">Danh sách chức năng
            </div>
            <div class="col-xs-12">
          
                @Html.CheckBoxListFor(x=>x.PostedFunction.FunctionID,x=>x.Functions,branch=>branch.FunctionID,branch=>branch.Name,x=>x.FunctionsSelected,Position.Vertical)
                              
          
            </div>
            <div class="col-xs-12">
                <input type="submit" class="btn btn-sm btn-primary" id="btnsave" name="btnsave" value="Save"/>
            </div>
            }
            <!-- /.col -->
        </div>
    <!-- /.row -->
</div>
<!-- /.page-content -->

<!-- inline scripts related to this page -->

<script type="text/javascript">
    $(document).ready(function() {

        $('#SelectedRoleID').change(function() {
            window.location = '/admin/role/permission/' + $(this).val();
        });
    });
 </script>